<pre>
from datetime import datetime
from functools import wraps

def write_log(logpath='default.log'):
    def out_wrapper(func):
        @wraps(func)
        def in_wrapper(*args, **kwargs):
            log = f"[{datetime.now()}] {func.__name__} is running"
            print(log)
            with open(logpath, 'a') as fd:
                fd.write(log + '\n')
            return func(*args, **kwargs)
        return in_wrapper
    return out_wrapper

@write_log('func1.log')
def func1():
    print('func1')
func1()
</pre>